home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Periodicals / CSMP / C.S.M.P. Digest, Issue 3.021 < prev    next >
Internet Message Format  |  1994-06-09  |  69KB

  1. From: pottier@clipper.ens.fr (Francois Pottier)
  2. Subject: csmp-digest-v3-021
  3. Date: Fri, 29 Apr 94 18:37:31 MET DST
  4.  
  5. C.S.M.P. Digest             Fri, 29 Apr 94       Volume 3 : Issue 21
  6.  
  7. Today's Topics:
  8.  
  9.         CW longjmp & destructor
  10.         Complete File Directory
  11.         Extensions-Patches w-PowerPC
  12.         Help: SetEventMask, MacApp, Sub-launching
  13.         Macintosh Disk Cache fix -- 25 times speedup
  14.         PowerMac Programming & the data bus
  15.         QuickDraw GX Questions
  16.         Quitting faceless background applications
  17.  
  18.  
  19.  
  20. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  21. (pottier@clipper.ens.fr).
  22.  
  23. The digest is a collection of article threads from the internet newsgroup
  24. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  25. regularly and want an archive of the discussions.  If you don't know what a
  26. newsgroup is, you probably don't have access to it.  Ask your systems
  27. administrator(s) for details.  If you don't have access to news, you may
  28. still be able to post messages to the group by using a mail server like
  29. anon.penet.fi (mail help@anon.penet.fi for more information).
  30.  
  31. Each issue of the digest contains one or more sets of articles (called
  32. threads), with each set corresponding to a 'discussion' of a particular
  33. subject.  The articles are not edited; all articles included in this digest
  34. are in their original posted form (as received by our news server at
  35. nef.ens.fr).  Article threads are not added to the digest until the last
  36. article added to the thread is at least two weeks old (this is to ensure that
  37. the thread is dead before adding it to the digest).  Article threads that
  38. consist of only one message are generally not included in the digest.
  39.  
  40. The digest is officially distributed by two means, by email and ftp.
  41.  
  42. If you want to receive the digest by mail, send email to listserv@ens.fr
  43. with no subject and one of the following commands as body:
  44.     help                        Sends you a summary of commands
  45.     subscribe csmp-digest Your Name    Adds you to the mailing list
  46.     signoff csmp-digest            Removes you from the list
  47. Once you have subscribed, you will automatically receive each new
  48. issue as it is created.
  49.  
  50. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  51. Questions related to the ftp site should be directed to
  52. scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP
  53. digest are available there.
  54.  
  55. Also, the digests are available to WAIS users as comp.sys.mac.programmer.src.
  56.  
  57.  
  58. -------------------------------------------------------
  59.  
  60. >From ueda@bug.co.jp (SHOJI UEDA)
  61. Subject: CW longjmp & destructor
  62. Date: Fri, 8 Apr 1994 12:57:45 GMT
  63. Organization: B.U.G. Inc.
  64.  
  65. Hi, CodeWarrior users and Metrowerks guys
  66.  
  67. I found a "longjmp & destructor" problem with CW 1.0a4 PPC/68K.
  68. Here is my test code.
  69. --
  70. #include <Types.h>
  71. #include <setjmp.h>
  72.  
  73. class CTest {
  74. public:
  75.         long field;
  76.         CTest(void);
  77.         ~CTest(void);
  78. };
  79.  
  80. CTest::CTest(void)
  81. {
  82.         field = 'CNST';
  83. }
  84.  
  85. CTest::~CTest(void)
  86. {
  87.         field = 'DEST';
  88. }
  89.  
  90. class CTest2 {
  91. public:
  92.         long field;
  93.         CTest2(void);
  94.         ~CTest2(void);
  95. };
  96.  
  97. CTest2::CTest2(void)
  98. {
  99.         field = 'CNST';
  100. }
  101.  
  102. CTest2::~CTest2(void)
  103. {
  104.         field = 'DEST';
  105. }
  106.  
  107. jmp_buf env;
  108.  
  109. void Func(void)
  110. {
  111.         CTest ctest;
  112.  
  113.         ctest.field = 'FUNC';
  114.         longjmp(env, 1);
  115. }
  116.  
  117. void main(void)
  118. {
  119.         CTest2 ctest2;
  120.  
  121.         ctest2.field = 'MAIN';
  122.         DebugStr("\pSTARTED");
  123.         if (setjmp(env) == 0) {
  124.                 Func();
  125.                 DebugStr("\pSUCCEEDED");
  126.         }
  127.         else
  128.                 DebugStr("\pFAILED");
  129.         DebugStr("\pEND");
  130. }
  131. - -
  132. This code will cause crash. This is because ctest defined in Func() already
  133. was removed from stack frame but its destructor called.
  134.  
  135. I tested this code with MPW CFront. CFront never call removed obejct's
  136. destructor. I don't understand removed object's destructor should be called
  137. or not. But MacApp3.1 failure mechanism uses longjmp() and destructor.
  138.  
  139. Thanks,
  140.  
  141.  
  142. +++++++++++++++++++++++++++
  143.  
  144. >From Jens Alfke <jens_alfke@powertalk.apple.com>
  145. Date: Tue, 12 Apr 1994 20:11:04 GMT
  146. Organization: Apple Computer
  147.  
  148. SHOJI UEDA, ueda@bug.co.jp writes:
  149. > This code will cause crash. This is because ctest defined in Func() already
  150. > was removed from stack frame but its destructor called.
  151.  
  152. Something's wrong here. longjmp() does NOT call destructors of local
  153. variables. I've been using setjmp/longjmp in an exception library of my own
  154. with no problems, and PowerPlant also uses them.
  155.  
  156. Take a look at the disassembly of your code and see what's happening around
  157. the call to longjmp...
  158.  
  159. --Jens Alfke
  160.   jens_alfke@powertalk              Rebel girl, rebel girl,
  161.             .apple.com              Rebel girl you are the queen of my world
  162.  
  163. +++++++++++++++++++++++++++
  164.  
  165. >From dpodwall@world.std.com (Dan Podwall)
  166. Date: Wed, 13 Apr 1994 16:36:43 GMT
  167. Organization: Metrowerks, Inc.
  168.  
  169. SHOJI UEDA (ueda@bug.co.jp) wrote:
  170. : Hi, CodeWarrior users and Metrowerks guys
  171.  
  172. : I found a "longjmp & destructor" problem with CW 1.0a4 PPC/68K.
  173. : Here is my test code.
  174.  
  175. As you know, longjmp doesn't call destructors for objects in
  176. the stack frames that it pops. But there is a bug in the C++ runtime
  177. that causes it to get confused and try to destroy objects that
  178. were in frames that were popped by a longjmp. This will be fixed in
  179. DR3. I'm not sure if this is something that we can make an interim fix
  180. for or not.
  181.  
  182. Dan Podwall
  183. Metrowerks, Inc.
  184.  
  185.  
  186. +++++++++++++++++++++++++++
  187.  
  188. >From johnmce@world.std.com (John McEnerney)
  189. Date: Thu, 14 Apr 1994 02:17:55 GMT
  190. Organization: The World Public Access UNIX, Brookline, MA
  191.  
  192. Jens Alfke <jens_alfke@powertalk.apple.com> writes:
  193.  
  194. >SHOJI UEDA, ueda@bug.co.jp writes:
  195. >> This code will cause crash. This is because ctest defined in Func() already
  196. >> was removed from stack frame but its destructor called.
  197.  
  198. >Something's wrong here. longjmp() does NOT call destructors of local
  199. >variables. I've been using setjmp/longjmp in an exception library of my own
  200. >with no problems, and PowerPlant also uses them.
  201.  
  202. This is actually a bug in CodeWarrior. The way the destruction of local 
  203. objects is implemented it is possible for the destructors to be called if 
  204. you exit the routine froma longjmp(). It will be fixed in DR3.
  205.  
  206. -- John McEnerney, Metrowerks PowerPC Product Architect
  207.  
  208.  
  209. ---------------------------
  210.  
  211. >From cowcorp@cairo.anu.edu.au (Matt Gallagher)
  212. Subject: Complete File Directory
  213. Date: 8 Apr 1994 03:52:46 GMT
  214. Organization: Australian National University
  215.  
  216. I need to get a complete directory listing of an HFS volume in Think C
  217. 5.0.4.
  218. I've tried recursively calling PBGetCatInfo, but this is ridiculously slow
  219. on my 500mb hard drive. Does anyone have any tips on how to do this more
  220. quickly?
  221.  
  222. Thanks in advance,
  223. Matt Gallagher
  224. cowcorp@cairo.anu.edu.au
  225.  
  226. +++++++++++++++++++++++++++
  227.  
  228. >From Scott_Gruby@hmc.edu (Scott Gruby)
  229. Date: 8 Apr 1994 04:19:53 GMT
  230. Organization: Harvey Mudd College, Claremont CA
  231.  
  232. In article <cowcorp-080494135647@150.203.60.160>, cowcorp@cairo.anu.edu.au
  233. (Matt Gallagher) wrote:
  234.  
  235. > I need to get a complete directory listing of an HFS volume in Think C
  236. > 5.0.4.
  237. > I've tried recursively calling PBGetCatInfo, but this is ridiculously slow
  238. > on my 500mb hard drive. Does anyone have any tips on how to do this more
  239. > quickly?
  240. > Thanks in advance,
  241. > Matt Gallagher
  242. > cowcorp@cairo.anu.edu.au
  243.  
  244. Sorry I can't answer this question, but on a similar note, what is the
  245. easiest way to list all files in a directory...as fast as possible would be
  246. great, but not necessary?
  247.  
  248. Thanks.
  249.  
  250. -- 
  251. Scott Allen Gruby                         (Scott_Gruby@hmc.edu)
  252. Macintosh Student System Manager
  253. Academic Computing, Harvey Mudd College
  254. Claremont, CA
  255.          Finger ripem_public@eagle.st.hmc.edu for public key
  256.  
  257. +++++++++++++++++++++++++++
  258.  
  259. >From jumplong@aol.com (Jump Long)
  260. Date: 9 Apr 1994 13:17:02 -0400
  261. Organization: America Online, Inc. (1-800-827-6364)
  262.  
  263. In article <cowcorp-080494135647@150.203.60.160>, cowcorp@cairo.anu.edu.au
  264. (Matt Gallagher) writes:
  265.  
  266. > I need to get a complete directory listing of an HFS volume in Think C
  267. > 5.0.4.
  268.  
  269. There are only a couple of methods you can use.
  270.  
  271. If you want the directory struture (you want to know what files and
  272. subdirectories are in a directory), you'll have to use PBGetCatInfo (as you
  273. said you've already tried).  I haven't tried this to find out if it makes any
  274. difference but... the Macintosh file system keeps a catalog hint when
  275. PBGetCatInfo is used with a positive index. That means that if you index
  276. through a directory using 1, 2, 3, 4..., the file system can find the next
  277. sequential directory entry a little faster.  So, you might get a little better
  278. performance if you index through a complete directory level before dropping
  279. down a level to index through its subdirectories.  I don't know because I
  280. haven't tried it. (This would be harder to code, though.)
  281.  
  282. If you don't need the directory structure and only need a list of all of the
  283. objects (files and directories) on the volume, you can use PBCatSearch to get
  284. fill an array of FSSpecs.  This will be a lot faster on local HFS hard disks
  285. but will probably be slower than the recursive search if the volume is an
  286. AppleShare volume.  (I tested this when writing the Technical Note "Searching
  287. Volumes-Solutions and Problems" and found that the search time for finding all
  288. files and directories on a Developer CD  was around 18 seconds with
  289. PBCatSearch. It took 6 minutes and 36 seconds with a recursive indexed search.)
  290.  
  291. - Jim Luther
  292.  
  293.  
  294. +++++++++++++++++++++++++++
  295.  
  296. >From blob@apple.com (Brian Bechtel)
  297. Date: 14 Apr 1994 21:36:28 -0700
  298. Organization: Apple Computer, Inc., Cupertino, California
  299.  
  300. Scott_Gruby@hmc.edu (Scott Gruby) writes:
  301.  
  302. >In article <cowcorp-080494135647@150.203.60.160>, cowcorp@cairo.anu.edu.au
  303. >(Matt Gallagher) wrote:
  304.  
  305. >> I need to get a complete directory listing of an HFS volume in Think C
  306. >> 5.0.4.
  307. >> I've tried recursively calling PBGetCatInfo, but this is ridiculously slow
  308. >> on my 500mb hard drive. Does anyone have any tips on how to do this more
  309. >> quickly?
  310.  
  311. >Sorry I can't answer this question, but on a similar note, what is the
  312. >easiest way to list all files in a directory...as fast as possible would be
  313. >great, but not necessary?
  314.  
  315. MoreFiles.  MoreFiles.  MoreFiles.
  316.  
  317. MoreFiles is an excellent collection of file manager sample code by Jim
  318. Luther of DTS.  It's available from
  319.  
  320.   ftp://ftp.apple.com/dts/mac/sc/morefiles.1.1.1.hqx
  321.  
  322. It has complete, working code which does both of the requested items
  323. above.
  324.  
  325. --Brian Bechtel     blob@apple.com     "My opinion, not Apple's"
  326.  
  327. ---------------------------
  328.  
  329. >From gdl@stlawrence.maths (Greg Landweber)
  330. Subject: Extensions-Patches w-PowerPC
  331. Date: 09 Apr 1994 16:26:51 GMT
  332. Organization: (none)
  333.  
  334. If I load and prepare a PowerPC code fragment from an INIT (using
  335. GetDiskFragment or loading it from a resource and calling
  336. GetMemFragment), will it be unloaded when my INIT exits?  I want the
  337. fragment to persist until the Mac is shut down, as if I had loaded and
  338. detached a 680x0 code resource in the system heap.
  339.  
  340. Basically, I have a code fragment containing a number of trap patches.
  341. The entry point is the routine that installs the trap patches and a
  342. Gestalt Selector routine also within the code fragment.
  343.  
  344. Thanks for your help.
  345.  
  346. -- Greg "Buttons" Landweber
  347.    gdl@maths.ox.ac.uk
  348.  
  349. +++++++++++++++++++++++++++
  350.  
  351. >From A.Lillich@AppleLink.Apple.com (Alan Lillich)
  352. Date: Mon, 11 Apr 1994 23:38:37 GMT
  353. Organization: Apple Computer, Inc.
  354.  
  355. In article <GDL.94Apr9172652@stlawrence.maths>, gdl@stlawrence.maths (Greg
  356. Landweber) wrote:
  357. > If I load and prepare a PowerPC code fragment from an INIT (using
  358. > GetDiskFragment or loading it from a resource and calling
  359. > GetMemFragment), will it be unloaded when my INIT exits?  I want the
  360. > fragment to persist until the Mac is shut down, as if I had loaded and
  361. > detached a 680x0 code resource in the system heap.
  362. > Basically, I have a code fragment containing a number of trap patches.
  363. > The entry point is the routine that installs the trap patches and a
  364. > Gestalt Selector routine also within the code fragment.
  365. > Thanks for your help.
  366. > -- Greg "Buttons" Landweber
  367. >    gdl@maths.ox.ac.uk
  368.  
  369. What you suggest works just fine.  I would suggest using the fragment's
  370. init routine to install the patches, then your init just has to call
  371. GetDiskFragment and make sure there is no error.  Note:  If VM is on
  372. GetDiskFragment will use file mapping on the data fork.  This may or may
  373. not be desirable, i.e. is your code only used at times when page faults are
  374. safe?
  375.  
  376. Alan Lillich.
  377.  
  378. +++++++++++++++++++++++++++
  379.  
  380. >From wdh@netcom.com (Bill Hofmann)
  381. Date: Tue, 12 Apr 1994 01:55:49 GMT
  382. Organization: NETCOM On-line Communication Services (408 241-9760 guest)
  383.  
  384. gdl@stlawrence.maths (Greg Landweber) writes:
  385. >If I load and prepare a PowerPC code fragment from an INIT (using
  386. >GetDiskFragment or loading it from a resource and calling
  387. >GetMemFragment), will it be unloaded when my INIT exits?  I want the
  388. >fragment to persist until the Mac is shut down, as if I had loaded and
  389. >detached a 680x0 code resource in the system heap.
  390. Once a fragment is loaded (at INIT time), it's open forever.  Of course,
  391. if you load a fragment from a resource, you had best DetachResource...
  392.  
  393. >Basically, I have a code fragment containing a number of trap patches.
  394. >The entry point is the routine that installs the trap patches and a
  395. >Gestalt Selector routine also within the code fragment.
  396. Yup, that'll work.  If you want to install fat patches, **as you should**
  397. most of the time, your entry point should instead be a routine which
  398. returns addresses of patches and takes old trap addresses, since you'll
  399. need to build a fat routine descriptor for each patch, and to do that,
  400. you need to also have a 680x0 version.  It's kind of an ugly mess, which
  401. can be archtected nicely with some effort.
  402.  
  403. If your patch is big enough that a mixed mode switch is worthwhile (> a
  404. few hundred anyway, probably a few thousand) lines of compiled code, then
  405. you can just patch native, and try this: make your initialization routine
  406. do the initing and patching, and you don't have to do anything but load
  407. the fragment: the init routine gets called automatically!  It's quite
  408. easy to do.  
  409.  
  410. >Thanks for your help.
  411. >-- Greg "Buttons" Landweber
  412. >   gdl@maths.ox.ac.uk
  413. No problem.
  414. -- 
  415. -Bill Hofmann                    wdh@netcom.COM
  416.  Fresh Software and Instructional Design    +1 510 524 0852
  417.  
  418. +++++++++++++++++++++++++++
  419.  
  420. >From leonardr@netcom.com (Leonard Rosenthol)
  421. Date: Tue, 12 Apr 1994 18:36:58 GMT
  422. Organization: Aladdin Systems, Inc.
  423.  
  424. In article <wdhCo4Ip3.CEz@netcom.com>, wdh@netcom.com (Bill Hofmann) wrote:
  425.  
  426. > gdl@stlawrence.maths (Greg Landweber) writes:
  427. > >If I load and prepare a PowerPC code fragment from an INIT (using
  428. > >GetDiskFragment or loading it from a resource and calling
  429. > >GetMemFragment), will it be unloaded when my INIT exits?  I want the
  430. > >fragment to persist until the Mac is shut down, as if I had loaded and
  431. > >detached a 680x0 code resource in the system heap.
  432. >
  433. > Once a fragment is loaded (at INIT time), it's open forever.  Of course,
  434. > if you load a fragment from a resource, you had best DetachResource...
  435.    True, it is open forever (well, assuming the file doesn't get closed ;)
  436. - HOWEVER the connection ID that you get back from
  437. GetMemFragment/GetDiskFragment is _PROCESS_ relative so that in order to
  438. use the fragment in multiple processes/application you have to either
  439. reload the fragment each time OR precompute and store the entry points at
  440. startup.
  441.  
  442.  
  443. Leonard
  444. - ------------------------------------------------------------------------
  445. Leonard Rosenthol                      Internet:       leonardr@netcom.com
  446. Director of Advanced Technology        AppleLink:      MACgician
  447. Aladdin Systems, Inc.                  GEnie:          MACgician
  448.  
  449. +++++++++++++++++++++++++++
  450.  
  451. >From zobkiw@datawatch.com (joe zobkiw)
  452. Date: Wed, 13 Apr 1994 12:26:38 GMT
  453. Organization: Datawatch Corporation
  454.  
  455. In article <leonardr-120494103658@leonardr.slip.netcom.com>,
  456. leonardr@netcom.com (Leonard Rosenthol) wrote:
  457.  
  458. > In article <wdhCo4Ip3.CEz@netcom.com>, wdh@netcom.com (Bill Hofmann) wrote:
  459. > > gdl@stlawrence.maths (Greg Landweber) writes:
  460. > > >If I load and prepare a PowerPC code fragment from an INIT (using
  461. > > >GetDiskFragment or loading it from a resource and calling
  462. > > >GetMemFragment), will it be unloaded when my INIT exits?  I want the
  463. > > >fragment to persist until the Mac is shut down, as if I had loaded and
  464. > > >detached a 680x0 code resource in the system heap.
  465. > >
  466. > > Once a fragment is loaded (at INIT time), it's open forever.  Of course,
  467. > > if you load a fragment from a resource, you had best DetachResource...
  468. > > 
  469. >    True, it is open forever (well, assuming the file doesn't get closed ;)
  470. > - HOWEVER the connection ID that you get back from
  471. > GetMemFragment/GetDiskFragment is _PROCESS_ relative so that in order to
  472. > use the fragment in multiple processes/application you have to either
  473. > reload the fragment each time OR precompute and store the entry points at
  474. > startup.
  475.  
  476. >> reload the fragment each time OR precompute and store the entry points
  477.  
  478. This sounds a bit confusing but...I load numerous fragments at startup (via
  479. an INIT), and call them all throughout the time the machine is on. Simply
  480. GetResource, DetachResource, GetMemFragment, and go...it works fine.
  481.  
  482. ___________________________________________________________
  483. _/_/_/_/   Joe Zobkiw                                   ,,,
  484.     _/     Senior Software Engineer                     - -
  485.   _/       Datawatch Corporation                         L
  486. _/_/_/_/   zobkiw@datawatch.com                          -
  487.  
  488. +++++++++++++++++++++++++++
  489.  
  490. >From wdh@netcom.com (Bill Hofmann)
  491. Date: Thu, 14 Apr 1994 00:35:40 GMT
  492. Organization: NETCOM On-line Communication Services (408 241-9760 guest)
  493.  
  494. zobkiw@datawatch.com (joe zobkiw) writes:
  495. ...
  496. >>> reload the fragment each time OR precompute and store the entry points
  497.  
  498. >This sounds a bit confusing but...I load numerous fragments at startup (via
  499. >an INIT), and call them all throughout the time the machine is on. Simply
  500. >GetResource, DetachResource, GetMemFragment, and go...it works fine.
  501.  
  502. Yes, Leonard, Joe's right.  I've done it too.  You don't have to worry
  503. about the process-relative nature because, of course, you're in the system
  504. context at INIT time.  But your general comment is well-taken.
  505.  
  506. -- 
  507. -Bill Hofmann                    wdh@netcom.COM
  508.  Fresh Software and Instructional Design    +1 510 524 0852
  509.  
  510. +++++++++++++++++++++++++++
  511.  
  512. >From zobkiw@datawatch.com (joe zobkiw)
  513. Date: Thu, 14 Apr 1994 12:21:47 GMT
  514. Organization: Datawatch Corporation
  515.  
  516. In article <wdhCo84BG.4HH@netcom.com>, wdh@netcom.com (Bill Hofmann) wrote:
  517.  
  518. > zobkiw@datawatch.com (joe zobkiw) writes:
  519. > ...
  520. > >>> reload the fragment each time OR precompute and store the entry points
  521. > >This sounds a bit confusing but...I load numerous fragments at startup (via
  522. > >an INIT), and call them all throughout the time the machine is on. Simply
  523. > >GetResource, DetachResource, GetMemFragment, and go...it works fine.
  524. > Yes, Leonard, Joe's right.  I've done it too.  You don't have to worry
  525. > about the process-relative nature because, of course, you're in the system
  526. > context at INIT time.  But your general comment is well-taken.
  527.  
  528. Leonard responded to me: 
  529.  
  530. "That's because your code has a SINGLE entry point and you built it with
  531. a MixedMode Header on the resource.  If you DON'T do that, and you resolve
  532. (FindSymbol) at runtime, the connection ID's are not valid across
  533. processes."
  534.  
  535. Now, he is right, I have a single entry point. Maybe there is more to it
  536. with multiple entry points. I don't know since I've not had to deal with
  537. that yet.
  538.  
  539. ___________________________________________________________
  540. _/_/_/_/   Joe Zobkiw                                   ,,,
  541.     _/     Senior Software Engineer                     - -
  542.   _/       Datawatch Corporation                         L
  543. _/_/_/_/   zobkiw@datawatch.com                          -
  544.  
  545. +++++++++++++++++++++++++++
  546.  
  547. >From leonardr@netcom.com (Leonard Rosenthol)
  548. Date: Thu, 14 Apr 1994 19:01:42 GMT
  549. Organization: Aladdin Systems, Inc.
  550.  
  551. In article <wdhCo84BG.4HH@netcom.com>, wdh@netcom.com (Bill Hofmann) wrote:
  552.  
  553. > zobkiw@datawatch.com (joe zobkiw) writes:
  554. > ...
  555. > >>> reload the fragment each time OR precompute and store the entry points
  556. > >This sounds a bit confusing but...I load numerous fragments at startup (via
  557. > >an INIT), and call them all throughout the time the machine is on. Simply
  558. > >GetResource, DetachResource, GetMemFragment, and go...it works fine.
  559. > Yes, Leonard, Joe's right.  I've done it too.  You don't have to worry
  560. > about the process-relative nature because, of course, you're in the system
  561. > context at INIT time.  But your general comment is well-taken.
  562.    Depends on whether you build a mixed mode header on the resource itself
  563. and whether you have one or multiple entry points.  
  564.  
  565.    If the former situation (single entry point, with no callbacks, and
  566. built with an MM header), then you are correct - you can load and call and
  567. be just fine.   BUT if you have a code frag with multiple entry points and
  568. you need to call FindSymbol, then the results are only relative to the
  569. process  - you need the correct connectionID for the process or FindSymbol
  570. will fail :(
  571.  
  572. Leonard
  573. - ------------------------------------------------------------------------
  574. Leonard Rosenthol                      Internet:       leonardr@netcom.com
  575. Director of Advanced Technology        AppleLink:      MACgician
  576. Aladdin Systems, Inc.                  GEnie:          MACgician
  577.  
  578. ---------------------------
  579.  
  580. >From steve.herman%express@freedom.msfc.nasa.gov (Steve Herman)
  581. Subject: Help: SetEventMask, MacApp, Sub-launching
  582. Date: Wed, 13 Apr 1994 12:48:37 -0500
  583. Organization: BCSS
  584.  
  585. MacApp 3.0.1(bullet) calls SetEventMask in it's DoRealInitToolBox()
  586. function to set SysEvtMask to everyEvent (0xFFFF).  According to Inside Mac
  587. the normal value of SysEvtMask is 0xFFEF which masks out keyUp events.
  588.  
  589. Where I have seen a problem is when I sub-launch applications from a MacApp
  590. application.  It appears that sub-launched applications "inherit" the value
  591. of SysEvtMask from the application which launched them.  Can anyone confirm
  592. that this is true???
  593.  
  594. Does anyone know just how/when a *sub-launched* application's low memory
  595. globals get initialized?  In my MacApp program I tried setting SysEvtMask
  596. to 0xFFEF, calling LaunchApplication() and then putting it back to 0xFFFF
  597. (to keep MacApp happy). But the sub-launched application still showed
  598. 0xFFFF after it launched.  Do I perhaps need to leave my SysEvtMask set at
  599. 0xFFEF until WaitNextEvent has been called a few times and the sub-launch
  600. has *really* taken place????
  601.  
  602. If I set SysEvtMask back to 0xFFEF in my MacApp application (and leave it
  603. that way) am I asking for trouble (I briefly searched through the source
  604. and didn't see anything obvious which MacApp was doing with keyUps)?
  605.  
  606. Despite all the documentation I've been able to find which states that apps
  607. which modify SysEvtMask should save it's previous value and then restore it
  608. before quitting, I can't find any indication that MacApp does this. As far
  609. as I can tell, however, this doesn't seem to cause a problem.
  610.  
  611. The reason I brought all this up is that we use an apparently "brain-dead"
  612. off the shelf product which I need to sub-launch AND which seems to get
  613. confused when it has to deal with keyUp events.
  614.  
  615. Thanks for any insight...
  616.  
  617. Steve
  618.  
  619. - --------------------------------------------------
  620. - Steve Herman - BCSS
  621. - Boeing Computer Support Services
  622. - Huntsville, AL
  623. - --------------------------------------------------
  624.  
  625. +++++++++++++++++++++++++++
  626.  
  627. >From jonpugh@netcom.com (Jon Pugh)
  628. Date: Thu, 14 Apr 1994 07:10:56 GMT
  629. Organization: NETCOM On-line Communication Services (408 241-9760 guest)
  630.  
  631. Steve Herman (steve.herman%express@freedom.msfc.nasa.gov) wrote:
  632. > MacApp 3.0.1(bullet) calls SetEventMask in it's DoRealInitToolBox()
  633. > function to set SysEvtMask to everyEvent (0xFFFF).  According to Inside Mac
  634. > the normal value of SysEvtMask is 0xFFEF which masks out keyUp events.
  635.  
  636. > Where I have seen a problem is when I sub-launch applications from a MacApp
  637. > application.  It appears that sub-launched applications "inherit" the value
  638. > of SysEvtMask from the application which launched them.  Can anyone confirm
  639. > that this is true???
  640.  
  641. Yes, I've dealt with this before and it is true.  You've nailed it.  I
  642. suspect your fix will work too, but I'll bet you've tried and know if it
  643. will work by now.  I solved it by making the sublaunched application fix
  644. its event mask, which isn't an option for you apparently.
  645.  
  646. > If I set SysEvtMask back to 0xFFEF in my MacApp application (and leave it
  647. > that way) am I asking for trouble (I briefly searched through the source
  648. > and didn't see anything obvious which MacApp was doing with keyUps)?
  649.  
  650. You simply won't get keyUp method calls, but since you probably don't use
  651. them, it won't matter if you turn them off.
  652.  
  653. Jon
  654.  
  655.  
  656. ---------------------------
  657.  
  658. >From Stuart Cheshire <cheshire@cs.stanford.edu>
  659. Subject: Macintosh Disk Cache fix -- 25 times speedup
  660. Date: 9 Apr 1994 17:25:44 GMT
  661. Organization: Stanford University
  662.  
  663. Here's a message I posted on Thursday to the Nuntius mailing list:
  664.  
  665. - ----------------------------------------------------------------
  666.  
  667. Has anyone else noticed that at the end of extracting a binary in
  668. Nuntius the disk light comes on, stays on for a few seconds, and
  669. freezes the Mac for that duration? It gets unbearable if you have
  670. a large disk cache, but even with only a 256K cache it can freeze
  671. the Mac for up to 5 seconds.
  672.  
  673. This is not the fault of Nuntius -- many other programs like BinHex
  674. decoders, uudecoders, archive expanders etc. seem to suffer the same
  675. problem.
  676.  
  677. This really annoys me. One of the good features of Nuntius is the way
  678. it lets you continue working while it is doing other things in the
  679. background, so having it freeze like this is particularly galling.
  680.  
  681. The problem is that Nuntius (and other programs) write their data to
  682. disk in chunks (say 4K each) and the Mac caches the blocks in its
  683. disk cache. When the file is closed the data is finally written to disk,
  684. and this is what causes the big freeze up. It would be much better if
  685. the data were written continually to disk, instead of in one big burst
  686. at the end.
  687.  
  688. Yesterday morning I wrote a little INIT which sets the File Manager
  689. "don't cache" bit for disk writes of 1K or more. It does this by
  690. installing the following patch on the _Write system call:
  691.  
  692.                  tst.w   IOParam.ioRefNum(a0)         ; Is this a file write?
  693.                  bmi.s   @sys_write
  694.                  cmp.l   #1024, IOParam.ioReqCount(a0); Is it at leask 1K?
  695.                  blo.s   @sys_write
  696.                  ori.w   #0x20, IOParam.ioPosMode(a0) ; Set "Don't cache" bit
  697. extern sys_write:jmp     0x12345678                   ; Resume the system call
  698.  
  699. One surprising artifact of this is that it not only amortises the disk
  700. time over all the writes, but it also makes it 25 times faster.
  701.  
  702. What?
  703.  
  704. Yes, it's true.
  705.  
  706. I set my disk cache to 768K, and wrote a test program which wrote to a
  707. file in 32 blocks of 16K each, making a total of 512K.
  708.  
  709. Without the INIT, the writes took almost no time, but the Close call
  710. took 11 seconds, averaging about 45K/second write rate.
  711.  
  712. With the INIT, the whole thing took under half a second, averaging
  713. over a megabyte per second.
  714.  
  715. Go figure.
  716.  
  717. This may not make much difference to people connecting over modem, but
  718. for people on Ethernet it makes a huge difference.
  719.  
  720. The INIT is below, in BinHex form. Decode it, install it, and let me
  721. know what you think.
  722.  
  723. It has no ICON, because the total size of the INIT (including balloon
  724. help) is just under 1K, and it seemed a pity to spoil that with a big
  725. fat colour icon. (Besides, I couldn't be bothered to draw one.)
  726.  
  727. - ----------------------------------------------------------------
  728.  
  729. Here is one reply I got, which proves I wasn't hallucinating:
  730.  
  731. >> From: joanna@mail.utexas.edu (Joanna L. Castillo)
  732. >> Subject: Re: Long Mac freezes with Nuntius (and other program)
  733. >> 
  734. >> Hi, Stuart -
  735. >> 
  736. >> >Yesterday morning I wrote a little INIT  [ ... ]
  737. >> 
  738. >> Wow!  I installed the INIT... I tried copying a folder that had several
  739. >> files and sub-folders (a little over 900K total) to a floppy.  With the
  740. >> INIT installed, it took about 30 seconds.  Without, it took 2 minutes.
  741. >> Thank you so much.
  742. >> 
  743. >> Joanna.
  744. >> 
  745. >> FYI:  I'm running a Mac IIci, 24MB RAM, cache card, ethernet, tuned
  746. >>       7.0.1 system, several inits, and disk cache set at 512K.
  747.  
  748. I'll post the source code for the INIT, and the test program, to a
  749. separate thread. This INIT itself is below.
  750.  
  751. Stuart Cheshire <cheshire@cs.stanford.edu>
  752.  * <A HREF="file://brubeck.stanford.edu/www/cheshire-bio.html">WWW</A>
  753.  * Stanford Distributed Systems Group Research Assistant
  754.  * Escondido Village Resident Computer Coordinator
  755.  * Macintosh Programmer
  756.  
  757. (This file must be converted with BinHex 4.0)
  758.  
  759. :$&GbDA4P9'KbEh9RD!"*6NP89h*8D!!!!!!!!!!!!rJBk3!!!!!"!!!!!i8!!!+
  760. &!!!!F`!)6Ud!3Le!!!`-J!#!!!"M"(!!B%)-VJ!!1TJ!$'3S$&GbDA4P9'KbEh9
  761. RD&S#!!!!58j*9&Gb9'J"!2rrrrm!!%P1594AFP4S!3$rrrrr!!!!!!!!!!!!!!!
  762. !!!!!!!!!UFK3'J!!!!!!!!2i!)!!!'-'F!"J!!$L)!aQ$#m(6VVr(PL2B!!!dNU
  763. (CJi[$%kk!0"BMh!!B!!!`!J(!!"R!P+()%a`!$!J4N"Q!U!K9B!X!,b(Ba3U"`b
  764. '!!!kQ'8Q$)F!!$UBCA"JBVb(C"3U"Jb'!!!kQ'48$)F!!$UBC&KJ'#!-B()J6$)
  765. J)!D3!)F!!!%H,``[#+Q53IVrq#K)B3!!a#KI6R9+D!!BDa!-U!!!"!!!*'8'!'J
  766. !)!!X6[N50&Ci6R919[rm51F(!#`Z!!JZ"J+(!!!)!%U(C`4`!@!#F!!D!%U(Cd!
  767. Z2!!!"!"#Tbmm!3#SENkk!*`YArrm3UF[2!%!UQj1ZJ#-)#lrr,#ICJBZ2!!!!J!
  768. #KJ!!"rqqKQ)',$`!!+LI3UFr"Km&6VS!C#eIrra#Tbmm!3#SRdkk!&3J,[rmX*p
  769. @`%3!60m!i%jH6R@09(*KF%&fB@PXB@*XC3!!,`Y(q[p@-$bJ!k0'*SK"q[mb-$b
  770. J!k*(,c`!!+'B6VVr3%S!@)pR"%kk!"SQAdje)Pm5(c!I5J&R"+G'B!+M4Lk)6Y%
  771. LAh!"SCK1d3!!!2B!!J!!!!!!!!!!!!%!kJ!"j&4SC5"AFQPdC94SFQpeCfJJ4AK
  772. dC@jcD@pZ)'*jF'&cFf9c)(4SC5"6HA0dC@h9Fb"MEh"j,@*KBfXJC'PcDb"MB@0
  773. SC5"QEh)JB@aX)(GbDA4PFb"dEb"NDA0V)'pQ)$&,)'pb)'GbC@&dCA)Z)%pZ)'e
  774. j)&&eB@4bB5!h-$!X)(GTG'JJB5"NDA0V)'0KBfKP)'pQ)$-i0%XX)(4SDA-JE@&
  775. VCA-JBf9bG'&TEL"KF("XD@0KG'P[ER-J-M8JG'PYCA-JCQ&cG'9b)(GSC@iJG'K
  776. PH5"hFQPdC5"dEb"NDA0V,J!!!!!E!3#!!!!!!c%Z-""AFQPdC94SFQpeCfJJ-5i
  777. `!!!!4J%!J!!!!!-a,M!lU5!fG'JJ3A"bD@`J-6Nj0#"6G(9KFR3J3fKPFfKTFQ8
  778. J2'0SCA0SDA*P3'0c,R0dB@jQEh*N,Q9NG6i!!!%!!!!$K3!!!S8!!!"c!*@8'!Y
  779. N!!!!(!"Q!!**6NP8!!!!'QKQC()!!!!QGQ9bF`!"!$)!!!!!8!!!!!!!!!$T`2r
  780. r!!!")J!!!!!!![rr!!!#(!#9NM3!!Irr!!!#1`#9Nf`-9h*TG'98D(*[G@GS-U)
  781. :
  782.  
  783. +++++++++++++++++++++++++++
  784.  
  785. >From rbauchsp@herbie.unl.edu (ROGER BAUCHSPIES)
  786. Date: 9 Apr 1994 21:26:54 GMT
  787. Organization: University of Nebraska--Lincoln    
  788.  
  789. Stuart Cheshire (cheshire@cs.stanford.edu) wrote:
  790. : Here's a message I posted on Thursday to the Nuntius mailing list:
  791.  
  792. : ------------------------------------------------------------------
  793.  
  794. : Has anyone else noticed that at the end of extracting a binary in
  795. : Nuntius the disk light comes on, stays on for a few seconds, and
  796. : freezes the Mac for that duration? It gets unbearable if you have
  797. : a large disk cache, but even with only a 256K cache it can freeze
  798. : the Mac for up to 5 seconds.
  799.  
  800. This is due to the design of the cache, which always writes cached 
  801. blocks in 512 byte pieces, regardless of how large they were when they
  802. cache grabbed them. I am writing a highly intelligent disk cache and 
  803. will be releasing it later this year. Depending on the marketplace at 
  804. that time, I may release both the source code and object code as 
  805. public domain.
  806.  
  807. Steve Kiene
  808. MindVision Software
  809.  
  810.  
  811. +++++++++++++++++++++++++++
  812.  
  813. >From Cameron Esfahani <dirty@guest.apple.com>
  814. Date: Sun, 10 Apr 1994 05:27:14 GMT
  815. Organization: Apple Computer, Inc.
  816.  
  817. In article <2o6oeo$8te@nntp2.Stanford.EDU> Stuart Cheshire,
  818. cheshire@cs.stanford.edu writes:
  819. > Has anyone else noticed that at the end of extracting a binary in
  820. > Nuntius the disk light comes on, stays on for a few seconds, and
  821. > freezes the Mac for that duration? It gets unbearable if you have
  822. > a large disk cache, but even with only a 256K cache it can freeze
  823. > the Mac for up to 5 seconds.
  824.  
  825. There is a perfectly logical explanation of why the disk cache
  826. sucks so bad in cases like this.  If the disk cache gets flushed,
  827. and there are a large number of dirty blocks in there, each block
  828. gets written out 1 at a time.  This means if you have a 1Meg cache
  829. and it has 256K dirty, then you will write out 512 blocks to
  830. disk.  Even if you have a fast drive this takes a little time.
  831.  
  832. This gives me a chance to evangelize the use of the 'noCacheBit'
  833. which is defined in SysEqu.a.  This tells the file system to not
  834. cache this transaction.  Please use this bit if you know you are
  835. not going to use the information that you are reading or writing
  836. again.  If you don't, the file system has to try to read your
  837. mind, and we all know how successfully that works.
  838.  
  839. Another way to speed up your usage of the file system is to never,
  840. ever use the newline mode in reading from a file.  The file system
  841. has to read data from the file 1 byte at a time.  This is slow. 
  842. If you want to simulate this, read from the file in large (>4K)
  843. chunks and search through it yourself.
  844.  
  845. This leads me into my next tip: read and write in large chunks. 
  846. It really is much more efficient to read and write in >4K chunks
  847. and pull your data out of there yourself.
  848.  
  849. With these few tips, you can increase your enjoyment of the Mac
  850. file system.
  851.  
  852. Cameron Esfahani
  853. dirty@apple.com
  854. General File-System Dude
  855.  
  856. +++++++++++++++++++++++++++
  857.  
  858. >From d88-jwa@mumrik.nada.kth.se (Jon W‰tte)
  859. Date: 10 Apr 1994 11:11:08 GMT
  860. Organization: The Royal Institute of Technology
  861.  
  862. In <2o6oeo$8te@nntp2.Stanford.EDU> Stuart Cheshire <cheshire@cs.stanford.edu> writes:
  863.  
  864. >Yesterday morning I wrote a little INIT which sets the File Manager
  865. >"don't cache" bit for disk writes of 1K or more. It does this by
  866. >installing the following patch on the _Write system call:
  867.  
  868. This has long been needed.
  869.  
  870. >Without the INIT, the writes took almost no time, but the Close call
  871. >took 11 seconds, averaging about 45K/second write rate.
  872. >With the INIT, the whole thing took under half a second, averaging
  873. >over a megabyte per second.
  874. >Go figure.
  875.  
  876. That's because the disk cache flushes itself in 512 byte blocks.
  877. Yes, that's right, at this day and age, the disk cache still
  878. iterates over its 512 byte blocks, writing ONE AT A TIME.
  879.  
  880. However, the next major system software release will have
  881. FINALLY fixed this problem. Yay! So your INIT should maybe
  882. check to see that the system version is < 7.2 or something?
  883.  
  884. Cheers,
  885.  
  886.                     / h+
  887.  
  888. -- 
  889.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
  890.     Not speaking for IBM.
  891.  
  892. +++++++++++++++++++++++++++
  893.  
  894. >From Stuart Cheshire <cheshire@cs.stanford.edu>
  895. Date: 10 Apr 1994 19:14:06 GMT
  896. Organization: Stanford University
  897.  
  898. In article <2o8msc$ro6@news.kth.se> Jon W!tte, d88-jwa@mumrik.nada.kth.se
  899. writes:
  900. >However, the next major system software release will have
  901. >FINALLY fixed this problem. Yay! So your INIT should maybe
  902. >check to see that the system version is < 7.2 or something?
  903.  
  904. Hey, the INIT is <1K. This is not a major software development. This is
  905. simply the result of waking up at 6:00am due to getting drunk the night
  906. before. Don't install it if it's not appropriate for your system.
  907.  
  908. Stuart Cheshire <cheshire@cs.stanford.edu>
  909.  * <A HREF="file://brubeck.stanford.edu/www/cheshire-bio.html">WWW</A>
  910.  * Stanford Distributed Systems Group Research Assistant
  911.  * Escondido Village Resident Computer Coordinator
  912.  * Macintosh Programmer
  913.  
  914. +++++++++++++++++++++++++++
  915.  
  916. >From philip@cs.wits.ac.za (Philip Machanick)
  917. Date: Mon, 11 Apr 1994 14:13:39 +0200
  918. Organization: Computer Science Dept, U of Witwatersrand
  919.  
  920. In article <2o9j5u$nt@nntp2.Stanford.EDU>, Stuart Cheshire
  921. <cheshire@cs.stanford.edu> wrote:
  922.  
  923. > Hey, the INIT is <1K. This is not a major software development. This is
  924. > simply the result of waking up at 6:00am due to getting drunk the night
  925. > before. Don't install it if it's not appropriate for your system.
  926.  
  927. Clearly still having fun. I may be at Stanford somewhere around 18 April.
  928. Maybe I'll see you then.
  929. -- 
  930. Philip Machanick                   philip@cs.wits.ac.za
  931. Department of Computer Science, University of the Witwatersrand
  932. 2050 Wits, South Africa
  933. phone 27(11)716-3309  fax 27(11)339-7965
  934. >From eric.larson@f620.n2605.z1.fidonet.org (eric larson)
  935. Subject: Macintosh Disk Cache fix -- 25 times speedup
  936. Date: 11 Apr 94 18:12:03 -0500
  937. Organization: FidoNet:* File Edit View Label Special                 ? D (1:2605/620)
  938.  
  939.  > This leads me into my next tip: read and write in large chunks.
  940.  > It really is much more efficient to read and write in >4K chunks
  941.  > and pull your data out of there yourself.
  942.  
  943.  > With these few tips, you can increase your enjoyment of the Mac
  944.  > file system.
  945.  
  946. How about a quick & -dare I say- dirty code snip?
  947.  
  948. +++++++++++++++++++++++++++
  949.  
  950. >From Ron_Hunsinger@bmug.org (Ron Hunsinger)
  951. Date: Wed, 13 Apr 94 00:09:16 PST
  952. Organization: Berkeley Macintosh Users Group
  953.  
  954. Stuart Cheshire <cheshire@cs.stanford.edu> writes:
  955.  
  956. >Yesterday morning I wrote a little INIT which sets the File Manager
  957. >"don't cache" bit for disk writes of 1K or more. It does this by
  958. >installing the following patch on the _Write system call:
  959.  
  960. Question: what happens in the following circumstance?
  961.  
  962.    1)  A program reads some data in several chunks of 512 bytes each 
  963.        (or even reads it all in one big chunk), having as a side effect 
  964.        that a copy of the data is now present in the cache.
  965.  
  966.    2)  The program modifies the data, and writes it out in one large
  967.        chunk.  Because of your patch, the cache is bypassed.
  968.  
  969.    3)  The program re-reads the data.
  970.  
  971. Does the program get the stale data that was placed in the cache in
  972. step 1, or the updated data that was written in step 2?
  973.  
  974. -Ron Hunsinger
  975.  
  976. +++++++++++++++++++++++++++
  977.  
  978. >From jumplong@aol.com (Jump Long)
  979. Date: 14 Apr 1994 16:40:02 -0400
  980. Organization: America Online, Inc. (1-800-827-6364)
  981.  
  982. In article <0013ABED.fc@bmug.org>, Ron_Hunsinger@bmug.org (Ron Hunsinger)
  983. writes:
  984.  
  985. > Question: what happens in the following circumstance?
  986. >    1)  A program reads some data in several chunks of 512 bytes each 
  987. >        (or even reads it all in one big chunk), having as a side effect 
  988. >        that a copy of the data is now present in the cache.
  989. >    2)  The program modifies the data, and writes it out in one large
  990. >        chunk.  Because of your patch, the cache is bypassed.
  991. >    3)  The program re-reads the data.
  992. > Does the program get the stale data that was placed in the cache in
  993. > step 1, or the updated data that was written in step 2?
  994.  
  995. You don't need to worry about this because the Macintosh file system cache code
  996. takes care of making sure you get the correct data. Any writes that bypass the
  997. cache will remove those blocks from the cache so the read in your step 3 would
  998. come from the disk driver, not the cache.
  999.  
  1000. So, the only way you can get data that's inconsistant with the file system
  1001. cache is to bypass the file system and read directly from the disk driver.
  1002. That's the reason we (Apple) tell developers of disk repair utilities to
  1003. unmount a volume before they read the disk directly. Unmounting a volume
  1004. flushes all dirty blocks (blocks that have been changes in the cache, but not
  1005. on disk) to disk and then trashes all cache blocks associated with that volume.
  1006.  
  1007. - Jim Luther
  1008.  
  1009.  
  1010. +++++++++++++++++++++++++++
  1011.  
  1012. >From rbauchsp@herbie.unl.edu (ROGER BAUCHSPIES)
  1013. Date: 15 Apr 1994 06:34:42 GMT
  1014. Organization: University of Nebraska--Lincoln    
  1015.  
  1016. Jump Long (jumplong@aol.com) wrote:
  1017. : So, the only way you can get data that's inconsistant with the file system
  1018. : cache is to bypass the file system and read directly from the disk driver.
  1019. : That's the reason we (Apple) tell developers of disk repair utilities to
  1020. : unmount a volume before they read the disk directly. Unmounting a volume
  1021. : flushes all dirty blocks (blocks that have been changes in the cache, but not
  1022. : on disk) to disk and then trashes all cache blocks associated with that volume.
  1023.  
  1024. Apple should tell developers to do the same for SCSI drivers with 
  1025. caches. RapidTrak and Iomega SCSI drivers contain their own cache, 
  1026. which they do NOT flush when a volume is unmounted. This causes 
  1027. problems with programs that bypass the SCSI driver and talk directly 
  1028. to the disk. As a rule, any cache should stop caching a volume if it 
  1029. is not online.
  1030.  
  1031. Steve Kiene
  1032. MindVision Software
  1033.  
  1034. ---------------------------
  1035.  
  1036. >From pburgess@netcom.com (Phillip Burgess)
  1037. Subject: PowerMac Programming & the data bus
  1038. Date: Thu, 14 Apr 1994 06:37:27 GMT
  1039. Organization: NETCOM On-line Communication Services (408 241-9760 guest)
  1040.  
  1041. A couple of questions about programming on the Power Macintosh...
  1042.  
  1043. How can I best take advantage of the PowerMac's 64-bit path to memory when
  1044. working with 32-bit integer values?  If I'm writing a number of 32-bit
  1045. values to a contiguous chunk of memory, do they (or can they) get stored
  1046. in pairs about as quickly as storing half as many noncontiguous values?
  1047. If so, what sort of flaming hoops, if any, do I need to jump through?
  1048. If memory can be accessed in this fashion, what about writing 4 contiguous
  1049. 16-bit values, or 8 contiguous bytes?  Same effect?
  1050.  
  1051. Also, how many integer and FP registers am I likely to actually have at my
  1052. disposal when using a C compiler such as MetroWorks'?
  1053. -- 
  1054.   Phillip Burgess   (pburgess@netcom.com)
  1055.  
  1056. +++++++++++++++++++++++++++
  1057.  
  1058. >From zstern@adobe.com (Zalman Stern)
  1059. Date: Thu, 14 Apr 1994 08:53:31 GMT
  1060. Organization: Adobe Systems Incorporated
  1061.  
  1062. Phillip Burgess writes
  1063. > A couple of questions about programming on the Power Macintosh...
  1064. > How can I best take advantage of the PowerMac's 64-bit path to memory when
  1065. > working with 32-bit integer values?  If I'm writing a number of 32-bit
  1066. > values to a contiguous chunk of memory, do they (or can they) get stored
  1067. > in pairs about as quickly as storing half as many noncontiguous values?
  1068. > If so, what sort of flaming hoops, if any, do I need to jump through?
  1069. > If memory can be accessed in this fashion, what about writing 4 contiguous
  1070. > 16-bit values, or 8 contiguous bytes?  Same effect?
  1071.  
  1072. On the 601 (which I assume is what we're talking about here), the the cache  
  1073. sits between the processor and the 64 bit databus. The path between the  
  1074. fixed-point unit and the cache is only 32 bits wide. There is a 64 bit  
  1075. datapath between the floating-point unit and the cache. The cache  
  1076. stores/fetches entire 32 byte blocks to/from memory (or secondary cache) at  
  1077. a time. Hence each 32 bit write from the fixed-point unit does not result in  
  1078. a memory transaction if you are writing to contiguous addresses. Unless you  
  1079. are writing to uncached memory. In that case the only way to get 64 bit bus  
  1080. transactions on at least some (if not all) current hardware is to use  
  1081. floating-point loads and stores. That may be a win even if you have to add a  
  1082. couple of cached loads and stores to make it work (e.g. to handle misaligned  
  1083. cases).
  1084.  
  1085. For writing contiguous regions of cached memory, you'll want to look into  
  1086. the dcbz instruction. Normally when you write to an address that is not in  
  1087. the cache, the hardware fetches that block before handling the store. This  
  1088. is obviously necessary as the cache will want to store the entire 32 byte  
  1089. block later and if you only wrote 32 bits of that, the rest of the block has  
  1090. to be valid. The dcbz (data cache block zero) instruction says "I'm going to  
  1091. write the entire cache block around this address so just make me a cache  
  1092. block of zeros for that address." This has the effect of storing zero to all  
  1093. addresses covered by the cache block.
  1094.  
  1095. There are a couple difficulties with dcbz. The first is discovering the  
  1096. cache block size. This is important as the correctness of your code will  
  1097. depend upon this size. A second difficulty is writing code that can do the  
  1098. dcbz instruction for each cache block for different block sizes. You can  
  1099. either put conditional code in your loop, or punt and write two versions of  
  1100. the code: a fast one that works for 32 byte blocks, and one that doesn't use  
  1101. dcbz for other block sizes. A third difficulty is accessing this instruction  
  1102. from C code. You'll either need a compiler that supports inline assembly, or  
  1103. you'll have to hand code the inner loop. The potential win of all this is  
  1104. reducing your applications memory bandwidth by up to a third.
  1105. --
  1106. Zalman Stern           zalman@adobe.com            (415) 962 3824
  1107. Adobe Systems, 1585 Charleston Rd., POB 7900, Mountain View, CA 94039-7900
  1108. "Do right, and risk consequences." Motto of Sam Houston (via Molly Ivins)
  1109.  
  1110. +++++++++++++++++++++++++++
  1111.  
  1112. >From d88-jwa@mumrik.nada.kth.se (Jon W‰tte)
  1113. Date: 14 Apr 1994 08:58:58 GMT
  1114. Organization: The Royal Institute of Technology
  1115.  
  1116. In <pburgessCo8L2F.DzG@netcom.com> pburgess@netcom.com (Phillip Burgess) writes:
  1117.  
  1118. >A couple of questions about programming on the Power Macintosh...
  1119.  
  1120. I would suggest a good book on processor architecture.
  1121.  
  1122. >working with 32-bit integer values?  If I'm writing a number of 32-bit
  1123. >values to a contiguous chunk of memory, do they (or can they) get stored
  1124. >in pairs about as quickly as storing half as many noncontiguous values?
  1125.  
  1126. Pretty much. It's more notable when you read sequentially through memory.
  1127.  
  1128. >If so, what sort of flaming hoops, if any, do I need to jump through?
  1129.  
  1130. None.
  1131.  
  1132. >If memory can be accessed in this fashion, what about writing 4 contiguous
  1133. >16-bit values, or 8 contiguous bytes?  Same effect?
  1134.  
  1135. Yeah, but misaligned reads take some time fixing up, and you also need
  1136. eight separate read/write instructions instead of two if you do bytes
  1137. instead of long words.
  1138.  
  1139. >Also, how many integer and FP registers am I likely to actually have at my
  1140. >disposal when using a C compiler such as MetroWorks'?
  1141.  
  1142. About 25 of each.
  1143.  
  1144. Cheers,
  1145.  
  1146.                     / h+
  1147. -- 
  1148.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
  1149.  
  1150.    There's no problem that can't be solved using brute-force algorithms
  1151.    and a sufficiently fast computer. Ergo, buy more hardware.    (NOT!)
  1152.  
  1153. ---------------------------
  1154.  
  1155. >From hslari@gibbs.oit.unc.edu (Humayun Lari)
  1156. Subject: QuickDraw GX Questions
  1157. Date: 28 Mar 1994 19:03:43 GMT
  1158. Organization: University of North Carolina, Chapel Hill
  1159.  
  1160. I have a couple of user-oriented questions about writing a graphics program
  1161. that uses GX. I don't have any obvious answers to these questions, so I'm
  1162. hoping someone else does:
  1163.  
  1164. 1. Since QuickDraw GX uses quadratic curves, it seems like it's going to be
  1165. harder for users to edit GX paths than it is for users to edit Postscript
  1166. paths that use cubic curves -- a la FreeHand or Illustrator. I asked this
  1167. question a year ago, and Tom Dowdy replied to the effect that it didn't
  1168. matter, since the application could present a different model (e.g. cubic
  1169. curves) to the user. That's true, but how can cubic curves be converted
  1170. into quadratic curves without loss of accuracy? The GX libraries have a
  1171. routine that does the conversion, but its documentation indicates that the
  1172. result can be slightly off. Is this error acceptable?
  1173.  
  1174. 2. The GX libraries use a 1-pixel wide bitmap ramp to produce linear
  1175. blends. Is there an effective way to produce radial blends that doesn't 
  1176. require a huge bitmap and thus large storage requirements?
  1177.  
  1178. Appreciatively,
  1179.  
  1180. Humayun Lari
  1181. (lari@email.unc.edu)
  1182.  
  1183. +++++++++++++++++++++++++++
  1184.  
  1185. >From dowdy@apple.com (Tom Dowdy)
  1186. Date: Fri, 1 Apr 1994 17:51:35 GMT
  1187. Organization: Apple Computer, Inc.
  1188.  
  1189. In article <2n79mf$gcf@bigblue.oit.unc.edu>, hslari@gibbs.oit.unc.edu
  1190. (Humayun Lari) wrote:
  1191. > 1. Since QuickDraw GX uses quadratic curves, it seems like it's going to be
  1192. > harder for users to edit GX paths than it is for users to edit Postscript
  1193. > paths that use cubic curves -- a la FreeHand or Illustrator. I asked this
  1194. > question a year ago, and Tom Dowdy replied to the effect that it didn't
  1195. > matter, since the application could present a different model (e.g. cubic
  1196. > curves) to the user. That's true, but how can cubic curves be converted
  1197. > into quadratic curves without loss of accuracy? The GX libraries have a
  1198. > routine that does the conversion, but its documentation indicates that the
  1199. > result can be slightly off. Is this error acceptable?
  1200.  
  1201. Well, since the result can be within 1 pixel (and you can't draw smaller
  1202. than that, and GX is device independant), the error is generally
  1203. acceptable.
  1204. The libraries show the basics of what need to be done -- and are
  1205. fairly accurate.  But they are provided as SOURCE CODE, so it's easy
  1206. to improve them from there.
  1207.  
  1208. However, if you need to make sure that when converting to something
  1209. that "supports" cubics native (like PostScript -- although actually
  1210. PostScript always blits everything as lines, and has it's own 
  1211. error (curveerror) built in anyway) you attach to the shape a 
  1212. cubic tag, which GX will use in preference to the quadratic data
  1213. when printing to a device that supports it (except if you apply
  1214. a non-linear transform to it (see below)).
  1215.  
  1216. As far as editing goes, you can present any model you wish to the
  1217. user -- and I honestly think that users don't want to EDIT using
  1218. control points (be they for quads or cubics) anyway.  There are
  1219. other editing models that are easier to use and that normal
  1220. people will probably prefer.
  1221.  
  1222. The question of quads vs. cubics has lots of history, but basically
  1223. (as far as GX is concerned) ends up stopping when you consider
  1224. the following:
  1225.  - cubics can't be intersected with other shape (the math is too difficult)
  1226.  - cubics can't be inset or outside mathematically, nor simplified
  1227.  - PostScript's implementation doesn't allow for perspective
  1228. transformation,
  1229.    so the cubic data can't be used in this case.
  1230.  
  1231. Developers of a GX savvy application will probably want to use many
  1232. of these features to let the user create shapes by combining/removing
  1233. and distorting exiting shapes to create new ones.  And because it
  1234. isn't mathematically possible to do this with cubics, these applications
  1235. will need to convert shapes into quadratics for these operations.
  1236.  
  1237. > 2. The GX libraries use a 1-pixel wide bitmap ramp to produce linear
  1238. > blends. Is there an effective way to produce radial blends that doesn't 
  1239. > require a huge bitmap and thus large storage requirements?
  1240.  
  1241. Well, traditionally, blends aren't done with a bitmap, but with a
  1242. series of inset/outset shapes.  For Version 1.0 this the only way
  1243. to do radial blends.  This is how most applications do blends today.
  1244. Some do their blends in PostScript, when available, and you can still
  1245. do this with GX.  Simply attach a PostScript tag to the picture
  1246. shape containing your blend -- this tag will be used when possible,
  1247. and when it isn't possible, the picture shape data will be used.
  1248.  
  1249. Note that either of these methods is by it's nature device DEPENDANT.
  1250. This is no worse than today's world (with respect to these objects),
  1251. and maybe a bit better (due to more properly allowing alternate
  1252. representations).
  1253.  
  1254. A future version of GX will very likely provide a "multi-color" model
  1255. for shapes, which would also allow for this type of ramp.  But for
  1256. 1.0 we had to stop someplace :-)
  1257.  
  1258. -- 
  1259.  Tom Dowdy                  Internet: dowdy@apple.COM
  1260.  Apple Computer MS:302-3KS  UUCP: {sun,voder,amdahl,decwrl}!apple!dowdy
  1261.  1 Infinite Loop            AppleLink: DOWDY1
  1262.  Cupertino, CA 95014       
  1263.  "The 'Ooh-Ah' Bird is so called because it lays square eggs."
  1264.  
  1265. +++++++++++++++++++++++++++
  1266.  
  1267. >From hslari@gibbs.oit.unc.edu (Humayun Lari)
  1268. Date: 3 Apr 1994 00:17:21 GMT
  1269. Organization: University of North Carolina, Chapel Hill
  1270.  
  1271. In article <dowdy-010494090912@17.202.72.12>, Tom Dowdy <dowdy@apple.com>
  1272. wrote:
  1273. >As far as editing goes, you can present any model you wish to the
  1274. >user -- and I honestly think that users don't want to EDIT using
  1275. >control points (be they for quads or cubics) anyway.  There are
  1276. >other editing models that are easier to use and that normal
  1277. >people will probably prefer.
  1278.  
  1279. Tom, thank you for your detailed and thorough response. I'm very
  1280. appreciative, but a couple of your answers invite a couple more
  1281. questions...
  1282.  
  1283. I've worked with most of the major Macintosh drawing programs, and as far
  1284. as I know, none of them allow you to edit complex paths without using
  1285. cubic (or spline) control points. Sure, some of them allow you to draw
  1286. freehand and produce the path for you, but none provide a different
  1287. editing model that "normal people" would like. What kind of model are you
  1288. referring to?
  1289.  
  1290. >> 2. The GX libraries use a 1-pixel wide bitmap ramp to produce linear
  1291. >> blends. Is there an effective way to produce radial blends that doesn't 
  1292. >> require a huge bitmap and thus large storage requirements?
  1293. >
  1294. >Well, traditionally, blends aren't done with a bitmap, but with a
  1295. >series of inset/outset shapes.  For Version 1.0 this the only way
  1296. >to do radial blends.  This is how most applications do blends today.
  1297. >Some do their blends in PostScript, when available, and you can still
  1298. >do this with GX.  Simply attach a PostScript tag to the picture
  1299. >shape containing your blend -- this tag will be used when possible,
  1300. >and when it isn't possible, the picture shape data will be used.
  1301. >
  1302. >Note that either of these methods is by it's nature device DEPENDANT.
  1303. >This is no worse than today's world (with respect to these objects),
  1304. >and maybe a bit better (due to more properly allowing alternate
  1305. >representations).
  1306. >
  1307. >A future version of GX will very likely provide a "multi-color" model
  1308. >for shapes, which would also allow for this type of ramp.  But for
  1309. >1.0 we had to stop someplace :-)
  1310.  
  1311. But by using a bitmap, the ramp library converts colors into RGB; doesn't
  1312. this make it device dependent? Or am I missing something? Similarly, if
  1313. radial blends are produced using, say, a sequence of 32 circles, would it
  1314. be appropriate to convert the blend colors into RGB before computing the
  1315. circle colors? Or would a color system such as CIE be more desirable?
  1316.  
  1317. Humayun Lari
  1318. (lari@email.unc.edu)
  1319.  
  1320. +++++++++++++++++++++++++++
  1321.  
  1322. >From 103t_english@west.cscwc.pima.edu
  1323. Date: 4 Apr 94 20:38:42 MST
  1324. Organization: (none)
  1325.  
  1326. In article <dowdy-010494090912@17.202.72.12>, dowdy@apple.com (Tom Dowdy) writes:
  1327. > A future version of GX will very likely provide a "multi-color" model
  1328. > for shapes, which would also allow for this type of ramp.  But for
  1329. > 1.0 we had to stop someplace :-)
  1330. Speaking of stopping someplace, is there an AE Suite associated with the GX
  1331. API in the works?
  1332.  
  1333.  
  1334. Lawson
  1335.  
  1336. +++++++++++++++++++++++++++
  1337.  
  1338. >From dowdy@apple.com (Tom Dowdy)
  1339. Date: Fri, 8 Apr 1994 18:03:15 GMT
  1340. Organization: Apple Computer, Inc.
  1341.  
  1342. In article <2nl1uh$nj0@bigblue.oit.unc.edu>, hslari@gibbs.oit.unc.edu
  1343. (Humayun Lari) wrote:
  1344.  
  1345. > I've worked with most of the major Macintosh drawing programs, and as far
  1346. > as I know, none of them allow you to edit complex paths without using
  1347. > cubic (or spline) control points. Sure, some of them allow you to draw
  1348. > freehand and produce the path for you, but none provide a different
  1349. > editing model that "normal people" would like. What kind of model are you
  1350. > referring to?
  1351.  
  1352. Well, one such model is constructing curves and shapes via the mathematical
  1353. joining and differencing of other shapes.  Another is by "nudging" or
  1354. "pulling" on areas of the curve using a shaped tool.
  1355.  
  1356. These can easily be done using QuickDraw GX geometry operations, and for
  1357. many types of editing may be more obvious for users.  Without GX geometry
  1358. doing the "hard work" for you, most applications writers have resorted
  1359. to using cubic or quadratic editing.  However, when cubic editing
  1360. first came out -- artists couldn't figure out how to use it.  This
  1361. shows that the *users* changed towards the model that the applications
  1362. provided rather than the other way around.
  1363.  
  1364. I *still* can't edit shapes via splines of any kind.
  1365.  
  1366. > >Note that either of these methods is by it's nature device DEPENDANT.
  1367. > >This is no worse than today's world (with respect to these objects),
  1368. > >and maybe a bit better (due to more properly allowing alternate
  1369. > >representations).
  1370. > >
  1371. > >A future version of GX will very likely provide a "multi-color" model
  1372. > >for shapes, which would also allow for this type of ramp.  But for
  1373. > >1.0 we had to stop someplace :-)
  1374. > But by using a bitmap, the ramp library converts colors into RGB; doesn't
  1375. > this make it device dependent? Or am I missing something? Similarly, if
  1376. > radial blends are produced using, say, a sequence of 32 circles, would it
  1377. > be appropriate to convert the blend colors into RGB before computing the
  1378. > circle colors? Or would a color system such as CIE be more desirable?
  1379.  
  1380. Yes, this is device DEPENDANT in terms of resolution-- this is no 
  1381. worse than things are today.  This is what I said about.
  1382.  
  1383. However, it is still device indepedant with respect to color,
  1384. even when expressing colors via RGB space.
  1385.  
  1386. As far as what color space the colors should be expressed in -- this
  1387. is up to the application.  One of the wonderful things about GX
  1388. is that applications can express color in spaces that work best for
  1389. them and their users -- and GX takes care of converting to the
  1390. correct display or output space for you. Included in this is GX's 
  1391. ability to correctly color match the results.
  1392.  
  1393. For ramps, most folks work in HSV/HSL or other "intensity" or "value"
  1394. type spaces.  CIE space is a bit difficult to produce ramps in --
  1395. probably even more so than RGB space.  But the important point
  1396. here is that it doesn't really matter.  Express the color as
  1397. YOU want (note that this includes bitmaps, which can be in
  1398. any GX's color spaces).  
  1399.  
  1400. Even though everything except the CIE
  1401. family of spaces is technically a dependant color space, QuickDraw
  1402. GX allows all spaces to be calibrated through use of a gxColorProfile.
  1403. When you don't specifically provide a source color profile, QuickDraw
  1404. GX makes use of the default monitor profile provide via ColorSync.
  1405.  
  1406. -- 
  1407.  Tom Dowdy                  Internet: dowdy@apple.COM
  1408.  Apple Computer MS:302-3KS  UUCP: {sun,voder,amdahl,decwrl}!apple!dowdy
  1409.  1 Infinite Loop            AppleLink: DOWDY1
  1410.  Cupertino, CA 95014       
  1411.  "The 'Ooh-Ah' Bird is so called because it lays square eggs."
  1412.  
  1413. +++++++++++++++++++++++++++
  1414.  
  1415. >From lari@cs.unc.edu (Humayun Lari)
  1416. Date: 15 Apr 1994 13:41:01 -0400
  1417. Organization: The University of North Carolina at Chapel Hill
  1418.  
  1419. In article <dowdy-080494105252@17.202.72.12>,
  1420. Tom Dowdy <dowdy@apple.com> wrote:
  1421. >Well, one such model is constructing curves and shapes via the mathematical
  1422. >joining and differencing of other shapes.  Another is by "nudging" or
  1423. >"pulling" on areas of the curve using a shaped tool.
  1424. >
  1425. >These can easily be done using QuickDraw GX geometry operations, and for
  1426. >many types of editing may be more obvious for users.  Without GX geometry
  1427. >doing the "hard work" for you, most applications writers have resorted
  1428. >to using cubic or quadratic editing.  However, when cubic editing
  1429. >first came out -- artists couldn't figure out how to use it.  This
  1430. >shows that the *users* changed towards the model that the applications
  1431. >provided rather than the other way around.
  1432. >
  1433. >I *still* can't edit shapes via splines of any kind.
  1434.  
  1435. Unfortunately, since existing applications *do* use splines, it seems
  1436. likely that programmers are going to continue using cubics or quadratics.
  1437. Users, as you say, have become accustomed to this model, so they may
  1438. actually *dislike* replacements. Beta 3 of GX doesn't appear to have any
  1439. examples of user interfaces that allow "nudging" or "pulling", which seem
  1440. to have the potential to replace the spline model. Does anyone (Tom? :-))
  1441. know of papers on such interfaces or have examples of existing applications
  1442. on other platforms that use better models? It would be ironic to have the
  1443. power of GX limited by old paradigms.
  1444.  
  1445. Humayun Lari
  1446. (lari@cs.unc.edu)
  1447.  
  1448. ---------------------------
  1449.  
  1450. >From blume@twg.com (David Blume)
  1451. Subject: Quitting faceless background applications
  1452. Date: Wed, 13 Apr 1994 18:58:38 GMT
  1453. Organization: Gokuraku Videos - Wollongong Dept.
  1454.  
  1455. What is the prefered way for the user to quit a faceless background
  1456. application?  (Besides finding a way to generate a "Quit" Apple Event.)
  1457.  
  1458. Also, and more importantly, once the faceless background application
  1459. quits, how do we tell the finder to update the icon for the application?
  1460. (Even when faceless background applications quit, their icons in the finder
  1461. stay in the grayed out "in use" state.)
  1462.  
  1463. For an example, try quitting the "ledApp" application from the Dec Dev. CD.
  1464.  
  1465. Thanks!
  1466. --David
  1467. +---------------------------------------------------------------+
  1468. |  David Blume    |  "I get tired thinking of all the things I  |
  1469. |  blume@twg.com  |   don't want to do."  --Bukowski, _Barfly_  |
  1470. +---------------------------------------------------------------+
  1471.  
  1472. +++++++++++++++++++++++++++
  1473.  
  1474. >From Philippe.Casgrain@univ-rennes1.fr (Philippe Casgrain)
  1475. Date: Wed, 13 Apr 1994 21:58:48 +0100
  1476. Organization: Universite de Rennes-1, Fac. de medecine dentaire
  1477.  
  1478. In article <1994Apr13.185838.21434@twg.com>, blume@twg.com (David Blume)
  1479. wrote:
  1480.  
  1481. > What is the prefered way for the user to quit a faceless background
  1482. > application?  (Besides finding a way to generate a "Quit" Apple Event.)
  1483.     I like the way Greg Robbins did it in his "SmallDaemon" sample: if a
  1484. modifier key is detected at the same time an AppleEvent is received (he
  1485. used Caps Lock, but it could be anything), then quit the app.
  1486.     Thus, you could quit the FBA by double-clicking on it with the Caps Lock
  1487. key down.
  1488.  
  1489. > Also, and more importantly, once the faceless background application
  1490. > quits, how do we tell the finder to update the icon for the application?
  1491. > (Even when faceless background applications quit, their icons in the finder
  1492. > stay in the grayed out "in use" state.)
  1493.     I don't think you can, it's a bug in the Finder (or so I remember
  1494. reading... here ;-)
  1495.  
  1496. Philippe
  1497. -- 
  1498. Philippe.Casgrain@univ-rennes1.fr
  1499.     Mac Hacker Lite
  1500.  
  1501. +++++++++++++++++++++++++++
  1502.  
  1503. >From markhanrek@aol.com (MarkHanrek)
  1504. Date: 14 Apr 1994 03:11:07 -0400
  1505. Organization: America Online, Inc. (1-800-827-6364)
  1506.  
  1507. >> What is the prefered way for the user to quit a faceless background
  1508. >> application?  Also, how do we tell the finder to update the icon for the
  1509. >> application?
  1510.  
  1511. The Finder icon for a faceless bkgnd task does not go back to normal after the
  1512. bkgnd task terminates. This is a bug and there is no workaround that I have
  1513. heard of.
  1514.  
  1515. Also, I would say that there is no preferred way for a user to terminate a
  1516. faceless bkgnd task, since these applications have no user interface, and if
  1517. there was a way, that would imply a user interface.
  1518.  
  1519. I would say that background-only applications should quit themselves and be
  1520. more like "agents". That would be more fun, eh? :)
  1521.  
  1522. In any case, I guess "it depends on the situation". (Dontcha hate answers like
  1523. that? :)
  1524.  
  1525. Mark Hanrek
  1526.  
  1527.  
  1528. +++++++++++++++++++++++++++
  1529.  
  1530. >From rmcassid@uci.edu (Robert Cassidy)
  1531. Date: Thu, 14 Apr 1994 10:16:10 -0700
  1532. Organization: TLG Project
  1533.  
  1534. In article <2oiqab$e5o@search01.news.aol.com>, markhanrek@aol.com
  1535. (MarkHanrek) wrote:
  1536.  
  1537. > >> What is the prefered way for the user to quit a faceless background
  1538. > >> application?  Also, how do we tell the finder to update the icon for the
  1539. > >> application?
  1540. > The Finder icon for a faceless bkgnd task does not go back to normal after the
  1541. > bkgnd task terminates. This is a bug and there is no workaround that I have
  1542. > heard of.
  1543. > Also, I would say that there is no preferred way for a user to terminate a
  1544. > faceless bkgnd task, since these applications have no user interface, and if
  1545. > there was a way, that would imply a user interface.
  1546. > I would say that background-only applications should quit themselves and be
  1547. > more like "agents". That would be more fun, eh? :)
  1548. > In any case, I guess "it depends on the situation". (Dontcha hate answers like
  1549. > that? :)
  1550. > Mark Hanrek
  1551.  
  1552. Powertalk Manager runs as an appe all the time. I haven't found of any good
  1553. way of killing it (other than running one of my buggier programs which
  1554. kills EVERYTHING :-)  FYI, Malph is a program which displays a list of all
  1555. running processes. It also includes appe's in the list and using balloon
  1556. help you can get such goodies as SIZE, Signature, location in memory, etc.
  1557. - very cool.
  1558.  
  1559. -- 
  1560. Robert Cassidy
  1561. TLG Project
  1562. UC Irvine
  1563.  
  1564. Let's hope 'Information SuperTollroad' isn't the catchphrase of the next
  1565. decade...
  1566.  
  1567. +++++++++++++++++++++++++++
  1568.  
  1569. >From David Casseres <casseres@apple.com>
  1570. Date: Thu, 14 Apr 1994 22:40:29 GMT
  1571. Organization: Apple Computer, Inc.
  1572.  
  1573. In article <2oiqab$e5o@search01.news.aol.com> MarkHanrek, markhanrek@aol.com
  1574. writes:
  1575. > >> What is the prefered way for the user to quit a faceless background
  1576. > >> application?  Also, how do we tell the finder to update the icon for the
  1577. > >> application?
  1578. > The Finder icon for a faceless bkgnd task does not go back to normal after
  1579. the
  1580. > bkgnd task terminates. This is a bug and there is no workaround that I have
  1581. > heard of.
  1582. > Also, I would say that there is no preferred way for a user to terminate a
  1583. > faceless bkgnd task, since these applications have no user interface, and if
  1584. > there was a way, that would imply a user interface.
  1585. > I would say that background-only applications should quit themselves and be
  1586. > more like "agents". That would be more fun, eh? :)
  1587.  
  1588. Yeah, I think the whole original question is a bit confused.  If it's faceless
  1589. then *by definition* the user has no way to interact with it.  I'd say there
  1590. are really two categories of faceless background apps:
  1591.  
  1592. 1.  System extensions, which are started by the system at startup and killed
  1593. at shutdown (though they may also be designed to quit themselves).  Their
  1594. icons never change in appearance, and the user doesn't normally look at them
  1595. since they're hidden away in the Extensions folder.
  1596.  
  1597. 2.  Programs that are launched by other programs and then controlled by them. 
  1598. The controlling program, assuming it has a user interface, might give the user
  1599. a way to kill the faceless background process.  When a program is launched by
  1600. some other program (not the Finder), its icon does not change in appearance.
  1601.  
  1602. I think maybe the original poster was thinking about a program with a
  1603. *minimal* user interface.  You can get away with no user interface except a
  1604. menu, which could contain a "Quit" item.  To do this the program should be a
  1605. normal Mac application, type 'APPL', launched normally by the Finder.  It
  1606. should be able to run both in foreground and background, since of course its
  1607. menu will only appear in the foreground.  The user can bring it to the
  1608. foreground by using the Finder's Application menu.
  1609.  
  1610. - -----------
  1611.  
  1612. David Casseres
  1613. Exclaimer: Hey!
  1614.  
  1615. +++++++++++++++++++++++++++
  1616.  
  1617. >From jumplong@aol.com (Jump Long)
  1618. Date: 15 Apr 1994 00:48:08 -0400
  1619. Organization: America Online, Inc. (1-800-827-6364)
  1620.  
  1621. In article <1994Apr13.185838.21434@twg.com>, blume@twg.com (David Blume)
  1622. writes:
  1623.  
  1624. > What is the prefered way for the user to quit a faceless background
  1625. > application?  (Besides finding a way to generate a "Quit" Apple Event.)
  1626.  
  1627. Since faceless background applications don't have a user interface, you'll have
  1628. to send it a quit Apple event to tell it to shut down (or send it a signal some
  1629. other way).
  1630.  
  1631. > Also, and more importantly, once the faceless background application
  1632. > quits, how do we tell the finder to update the icon for the application?
  1633. > (Even when faceless background applications quit, their icons in the finder
  1634. > stay in the grayed out "in use" state.)
  1635.  
  1636. If the faceless background application is of file type 'APPL', then there's
  1637. nothing you can do about the grayed out icon.  The Finder doesn't track the
  1638. state of faceless background applications correctly (as pointed out by others).
  1639.  However, there's nothing forcing you to use type 'APPL'.
  1640.  
  1641. If you want the application automatically launched at system startup time, you
  1642. can use a file type of 'appe'.  If you use 'appe', then the Finder will
  1643. automatically put the application in the Extensions folder when the application
  1644. is dropped on the System Folder and the application will be launched a startup
  1645. time.
  1646.  
  1647. If you *don't* want the application launched at system startup time, you can
  1648. use just about any other file type that makes sense to you (don't use anything
  1649. goffy like 'TEXT'), but you'll have to launch the application yourself.
  1650.  
  1651. Here's an real-life example... The File Sharing Extension is an 'INIT' file in
  1652. the Extensions folder that implements Macintosh File Sharing.  The File Sharing
  1653. Extension contains an 'INIT' resource which installs the parts of the file
  1654. server software that always need to be available including the _ServerDispatch
  1655. (A094) trap.  One of the routines implemented through _ServerDispatch is
  1656. SCStartServer.  When SCStartServer is called, the trap code launches the file
  1657. server application.  Guess where the file server application code is?  It's in
  1658. the File Sharing Extension file (if you don't believe me, just look).
  1659.  
  1660. So, you could do something similar.  You'd just need to use a small application
  1661. to control your faceless background application.  The controlling application
  1662. would launch the faceless background application to start it and send the
  1663. faceless background application a quit Apple event when it needed to shut it
  1664. down.
  1665.  
  1666. - Jim Luther
  1667.  
  1668.  
  1669. ---------------------------
  1670.  
  1671. End of C.S.M.P. Digest
  1672. **********************
  1673.  
  1674.  
  1675.  
  1676.